package com.ks.service;

import com.ks.entity.Unit;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ks.base.BaseService;
import com.ks.dao.UnitDao;

import java.util.List;

@Service("unitService")
public class UnitService<T> extends BaseService<T> {
    private final static Logger log = Logger.getLogger(UnitService.class);

    @Autowired
    private UnitDao<T> dao;

    public UnitDao<T> getDao() {
        return dao;
    }

    public Boolean queryCode(Object o){
        List<Unit> units = dao.findByCode(o);
        if(units.size()==0){
            return true;
        }else {
            return false;
        }
    }

    public Boolean queryIdentifier(Object o){
        List<Unit> units = dao.findByIdentifier(o);
        if(units.size()==0) {
            return true;
        }else{
            return false;
        }
    }

}
